import { ElTable } from "element-plus";
type ElTableType = InstanceType<typeof ElTable>

export interface ElTableFns {
  // element-plus table 方法
  clearSelection: ElTableType['clearSelection'],
  getSelectionRows: ElTableType['getSelectionRows'],
  toggleRowSelection: ElTableType['toggleRowSelection'],
  toggleAllSelection: ElTableType['toggleAllSelection'],
  toggleRowExpansion: ElTableType['toggleRowExpansion'],
  setCurrentRow: ElTableType['setCurrentRow'],
}

export const getElTableFns = (tatget: ElTableFns) => {
  return {
    clearSelection: tatget?.clearSelection,
    getSelectionRows: tatget?.getSelectionRows,
    toggleRowSelection: tatget?.toggleRowSelection,
    toggleAllSelection: tatget?.toggleAllSelection,
    toggleRowExpansion: tatget?.toggleRowExpansion,
    setCurrentRow: tatget?.setCurrentRow,
  }
}